import Vue from 'vue'
import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


//二级路由
import Member from '@/pages/member/member';//用户列表
import Enterprise from '@/pages/contentManagement/enterprise';//企业管理
import Person from '@/pages/contentManagement/person';//人物管理
import Brand from '@/pages/contentManagement/brand';//人物管理
import Propaganda from '@/pages/propaganda/propaganda';
import QuestionBank from '@/pages/question/questionBank';//题库列表
import Subject from '@/pages/question/subject';//题库列表
import Banner from '@/pages/system/banner';//轮播图管理
import Administrator from '@/pages/system/administrator';//轮播图管理
import ContentAdvert from '@/pages/contentManagement/contentAdvert';//广告语
import Record_Integral from './../pages/integral/record_integral'; //积分管理
import Record_rule from './../pages/integral/record_rule'; //规则说明
import Distribution_Rule from './../pages/system/distribution_rule'; //分销规则
import Set_Meal from './../pages/system/set_meal'; //收费套餐
import Account from './../pages/account/account'; //我的账号
import UserMeal from './../pages/member/user_meal'; //设置套餐
import Examine from './../pages/contentManagement/examine'; //审核列表
import Service from './../pages/system/service_agreement'; //服务协议
import Mechanism from './../pages/contentManagement/mechanism'; //机构管理
import Equity_rule from './../pages/system/equity_rule'; //用户权益及规则

Vue.use(Router)

export default new Router({
  routes: [
    {
      path:'/login',
      component: ()=>import ('./../pages/login/login'),
      name: 'Login',
      meta:{
        title:'登录'
      }
    },
    {
      path: '/',
      component: ()=>import ('./../pages/login/login'),
      redirect:'/login',
      meta:{
        title:'登录'
      }
    },
    {
      path:'/home',
      component: ()=>import ('./../pages/home/home'),
      name: 'Home',
      redirect:'/member',
      meta:{
        title:'首页'
      },
      children:[
        {
          path:'/member',
          component: Member,
          name: 'Member',
          meta:{
            father_title:'用户管理',
            title:'用户列表'
          },
        },
        {
          path:'/person',
          component: Person,
          name: 'Person',
          meta:{
            father_title:'内容管理',
            title:'人物列表'
          }
        },
        {
          path:'/brand',
          component: Brand,
          name: 'Brand',
          meta:{
            father_title:'内容管理',
            title:'品牌列表'
          }
        },
        {
          path:'/enterprise',
          component: Enterprise,
          name: 'Enterprise',
          meta:{
            father_title:'内容管理',
            title:'企业列表'
          }
        },
        {
          path:'/mechanism',
          component: Mechanism,
          name: 'Mechanism',
          meta:{
            father_title:'内容管理',
            title:'机构列表'
          }
        },
        {
          path:'/propaganda',
          component: Propaganda,
          name: 'Propaganda'
        },
        {
          path:'/questionBank',
          component: QuestionBank,
          name: 'QuestionBank'
        },
        {
          path:'/subject',
          component: Subject,
          name: 'Subject'
        },
        {
          path:'/banner',
          component: Banner,
          name: 'Banner',
          meta:{
            father_title:'系统管理',
            title:'轮播图管理'
          }
        },
        {
          path:'/administrator',
          component: Administrator,
          name: 'Administrator'
        },
        {
          path:'/contentAdvert',
          component:ContentAdvert,
          name:'ContentAdvert',
          meta:{
            father_title:'内容管理',
            title:'推广文案'
          }
        },
        {
          path:'/record_integral',
          component:Record_Integral,
          name:'record_integral',
          meta:{
            father_title:'积分管理',
            title:'兑换管理'
          }
        },
        {
          path:'/record_rule',
          component:Record_rule,
          name:'record_rule',
          meta:{
            father_title:'积分管理',
            title:'规则说明'
          }
        },
        {
          path:'/distribution_rule',
          component:Distribution_Rule,
          name:'distribution_rule',
          meta:{
            father_title:'系统管理',
            title:'分销规则'
          }
        },
        {
          path:'/set_meal',
          component:Set_Meal,
          name:'set_meal',
          meta:{
            father_title:'系统管理',
            title:'收费套餐'
          }
        },
        {
          path:'/account',
          component:Account,
          name:'account',
          meta:{
            father_title:'账号管理',
            title:'我的账号'
          }
        },
        {
          path:'/user_meal',
          component:UserMeal,
          name:'user_meal',
          meta:{
            father_title:'用户列表',
            title:'设置套餐'
          }
        },
        {
          path:'/examine',
          component:Examine,
          name:'examine',
          meta:{
            father_title:'内容管理',
            title:'审核列表'
          }
        },
        {
          path:'/service_agreement',
          component: Service,
          name:'service_agreement',
          meta:{
            father_title:'系统管理',
            title:'服务协议'
          }
        },
        {
          path:'/equity_rule',
          component: Equity_rule,
          name:'equity_rule',
          meta:{
            father_title:'系统管理',
            title:'用户权益及规则'
          }
        },
      ],
    }
  ]
})
